package com.iman.manjusri.web.home;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.iman.common.support.Page;
import com.iman.manjusri.service.BlogService;
import com.iman.manjusri.service.HomeHyService;
import com.iman.manjusri.vo.BlogVo;
import com.iman.manjusri.vo.HomeVo;
import com.iman.manjusri.web.BaseController;

@Controller
@RequestMapping(value = "/home/*")
public class SpaceHomeController extends BaseController {

	@Autowired
	private BlogService blogService;
	
	@Autowired
	HomeHyService homeHyService;

	@RequestMapping(value = "/space")
	public ModelAndView resourceMore(HttpServletRequest request)
			throws Exception {
		ModelAndView view = new ModelAndView("home/space");

		Map<String, Object> model = new HashMap<String, Object>();

		Page<BlogVo> p1 = blogService.getBlogList(3, 10, 1);
		view.addObject("p1", p1);
		
		Page<HomeVo> p2 = homeHyService.getHome(2, 3, 1);
		view.addObject("p2",p2);
		
		Page<HomeVo> p3 = homeHyService.getHome(1, 6, 1);
		view.addObject("p3",p3);

		// 资源 图片js css
		putResourceSrc(view);
		return view;
	};

}
